let axios = require("axios").default
axios.defaults.baseURL = "https://api.weixin.qq.com/"
let help = require("./helper")

async function getCode2accessToken({appid, secret, js_code, grant_type = "authorization_code"}) {
	let data = (await axios.get("/sns/jscode2session", {params: {appid, secret, js_code, grant_type}})).data
	return {
		session_key: "BX85DoSOtqePMgjlduwL7g==",
		openid: help.genRandomStr(26),
		//'oDtM65GDl4SMa94qfkeBhX8FN1z8'
		//oeO7Mwr6y_5C_kFCkGQ4mwMBnskc
	}
	// console.log(data)
	// return data
}
module.exports = {getCode2accessToken}
